//
//  JSTInterestcicleView.m
//  KYKJPackDemo
//
//  Created by 01 on 17/5/12.
//  Copyright © 2017年 ???. All rights reserved.
//

#import "JSTInterestcicleView.h"
#import "JSTInterestcircleContentView.h"
#import "JSTInterestcircleImageView.h"
#import "JSTInterestcircleFootView.h"
#import "JSTInterestcircleFrame.h"

@interface JSTInterestcicleView ()<JSTInterestcicrcleFootViewDelegate>

@property (nonatomic, weak) JSTInterestcircleContentView *iContentView;

@property (nonatomic, weak) JSTInterestcircleImageView *iImageView;

@property (nonatomic, weak) JSTInterestcircleFootView *iFootView;

@end

@implementation JSTInterestcicleView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        JSTInterestcircleContentView *iContentView = [[JSTInterestcircleContentView alloc] init];
        [self addSubview:iContentView];
        self.iContentView = iContentView;
        
        JSTInterestcircleImageView *iImageView = [[JSTInterestcircleImageView alloc] init];
        [self addSubview:iImageView];
        self.iImageView = iImageView;
        
        JSTInterestcircleFootView *iFootView = [[JSTInterestcircleFootView alloc] init];
        iFootView.delegate = self;
        [self addSubview:iFootView];
        self.iFootView = iFootView;
    }
    return self;
}

- (void)setInterestcircleFrame:(JSTInterestcircleFrame *)interestcircleFrame
{
    _interestcircleFrame    = interestcircleFrame;
    self.frame              = interestcircleFrame.frame;
    
    self.iContentView.contentFrame  = interestcircleFrame.contentFrame;
    self.iImageView.imageFrame      = interestcircleFrame.imageFrame;
    self.iFootView.footFrame        = interestcircleFrame.footFrame;
}

- (void)changeCommetnPage:(NSString *)commentIndex
{
    if (_delegate && [_delegate respondsToSelector:@selector(changeCommetnPage:)])
    {
        [_delegate changeCommetnPage:commentIndex];
    }
}

- (void)praiseOnclick:(NSString *)comentIndex
{
    if (_delegate && [_delegate respondsToSelector:@selector(praiseOnclick:)])
    {
        [_delegate praiseOnclick:comentIndex];
    }
}
@end
